<?php
include_once("includes/config.php");
db_connection();
$username = $_POST["regUsername"];
$password = $_POST["regPassword"];
$email = $_POST["regEmail"];
//$username = "abc";
//$password = "abc";
//run the query to search for the username and password the match
//$query = "SELECT * FROM tbl_user WHERE username = '$username' AND password = '$password'";
//$result = mysql_query($query) or die("Unable to verify user because : " . mysql_error());
$query = "SELECT * FROM tbl_user WHERE username = '$username' OR email = '$email'";
$result = mysql_query($query) or die("Unable to verify user because : " . mysql_error());
if(mysql_num_rows($result) != 0)
{
	echo "__failed__";  // error, not unique
}
else
{
	$query = "INSERT INTO tbl_user VALUES (null, '";
	$query .= $username."', '".$password."',100,0,'".$email."')";
	mysql_query($query) or die("Unable to verify user because : " . mysql_error());
	echo "__successful__"; // ok
}
db_close();
?> 